var models = require('../../db/models')
var server = require('../server')
var db = require('../../db/connect')
var encrypt = require('../../libs/encrypt')
var jsonres = require('../../libs/jsonres')
require('../../libs/dateformat')

server.get('/api/todaymatch',function(req,res) {
    var u = req.query.user
    var p = req.query.platform
    console.log(new Date(new Date(Date.now() + (8 * 60 * 60 * 1000)).Format("yyyy-MM-dd")))
    db.find('tasks',{platform: p, user: u, finished: true, time: {'$gte': new Date(new Date(Date.now() + (8 * 60 * 60 * 1000)).Format("yyyy-MM-dd"))}},function(err,result) {
        if (!!!err) {
            res.send(jsonres(200,'success',result))
        } else {
            res.send(jsonres(-1,'查询失败',err))
        }
    })
})
